package OrderManager;
import Method.Conexcute;

import java.io.IOException;
import java.sql.*;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.Part;
@WebServlet(urlPatterns = "/Uporder")
public class UporderServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        int str=Integer.valueOf(request.getParameter("str"));
        String us_id= request.getParameter("us_id");
        String pr_id=request.getParameter("pr_id");
        String price=request.getParameter("price");
        String number=request.getParameter("number");
        String date=request.getParameter("date");
        Conexcute conexcute=new Conexcute();
        System.out.println("update rder set us_id='"+us_id+"',pr_id='"+pr_id+"',price='"+price+"',number='"+number+"',date='"+date+"' where or_id='"+str+"'");
        if(conexcute.execute("update rder set us_id='"+us_id+"',pr_id='"+pr_id+"',price='"+price+"',number='"+number+"',date='"+date+"' where or_id='"+str+"'")){
            response.setContentType("text/html");
            response.setCharacterEncoding("UTF-8");
            response.getWriter().println("数据修改成功");
            response.sendRedirect("OrderManager/order.jsp");
        }
    }
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        doGet(request, response);
    }
}
